<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1,user-scalable=no"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <title>文件搜索</title>
    <base href="{$_G['siteurl']}" />
    <script type="text/javascript">var DZZSCRIPT='{DZZSCRIPT}',LANG='{$_G[language]}', STATICURL = 'static/', IMGDIR = '{$_G[setting][imgdir]}', VERHASH = '{VERHASH}', charset = '{CHARSET}', dzz_uid = '$_G[uid]', cookiepre = '{$_G[config][cookie][cookiepre]}', cookiedomain = '{$_G[config][cookie][cookiedomain]}', cookiepath = '{$_G[config][cookie][cookiepath]}',attackevasive = '{$_G[config][security][attackevasive]}', disallowfloat = '{$_G[setting][disallowfloat]}',  REPORTURL = '$_G[currenturl_encode]', SITEURL = '$_G[siteurl]', JSPATH = '$_G[setting][jspath]',MOD_PATH='{MOD_PATH}',APP_URL='{MOD_URL}',MOD_URL='{MOD_URL}';</script>
    <link href="static/jquery_weui/css/jquery-weui.min.css" rel="stylesheet">
    <link href="static/jquery_weui/css/weui.min.css" rel="stylesheet">
    <link href="static/dzzicon/icon.css" rel="stylesheet">
    <link href="{MOD_PATH}/css/mobile/index.css" rel="stylesheet">
    <link href="{MOD_PATH}/css/mobile/package.css" rel="stylesheet">
</head>
<body>
<!--搜索框开始-->
<header class="weui-search-bar" id="searchBar">
    <form class="weui-search-bar__form" action="" onsubmit="return getSearchData();">
        <div class="weui-search-bar__box">

            <input type="search" class="weui-search-bar__input" id="searchInput" placeholder="全部或部分文件名" required="">
            <a href="javascript:" class="weui-search-bar__cancel-btn" id="searchCancel"><i class="weui-icon-clear"></i></a>
        </div>
        <label class="weui-search-bar__label" id="searchText">
            <span>全部或部分文件名</span>
            <i class="weui-icon-search"></i>
        </label>
    </form>
    <a href="javascript:" class="weui-search-return__cancel-btn" id="searchreturn">取消</a>
</header>
<!--搜索框结束-->
<!--搜索内容开始 -->
<section class="weui-search-con weui-cells hide" data-height="topheight">
    <div class="weui-cell weui-cell-search">
        <div class="weui-cell__hd"><span class="dzz dzz-grade weui-cell__img weui-cell__search"></span></div>
        <div class="weui-cell__bd">
            <p><span class="weui-search-word">搜索：</span><i class="weui-search-value"></i></p>
        </div>
    </div>
</section>
<!--搜索内容结束 -->
<section class="weui-cells weui-cells__recent weui-cells__margin_footer" id="fileList-search">
	

</section>
<!--无内容提示页-->
<div class="weui-cell-search-normal" style="display: none;">
		<!--{template mobile/template_normal}-->
</div>
<!--列表结束-->
</body>
<script type="text/javascript" src="static/jquery/jquery.min.js"></script>
<script type="text/javascript" src="static/jquery_weui/js/jquery-weui.min.js"></script>
<script type="text/javascript" src="{MOD_PATH}/js/mobile/appevent.js"></script>
<script type="text/javascript" src="{MOD_PATH}/js/mobile/permcheck.js"></script>
<script type="text/javascript" src="{MOD_PATH}/js/mobile/index.js"></script>
<script type="text/javascript">
    var fid = '{$fid}',cid='{$cid}',collect='{$collect}';
    $(function () {
        _filemanage.getConfig(MOD_URL+'&op=mobile&do=json', function (data) {
            _filemanage.contains = 'fileList-search';
            _filemanage.dataurl = '{MOD_URL}&op=mobile&do=search&operation=filelist';
        })
        //搜索页直接获取焦点
        $('#searchBar').addClass('weui-search-bar_focusing');
        $('#searchBar').find('.weui-search-bar__input').trigger("click").focus();
        //取消搜索返回上一页
        $(document).on('tap', '#searchreturn', function () {
            window.history.go(-1);
        })
//出现搜索按钮
        $(document).off('keyup.search').on('keyup.search', '#searchInput', function (e) {
            setTimeout(function () {
                setsearchVal();
            }, 500);
        })
        function setsearchVal() {
            var val = $('#searchInput').val(),
                emptypreg = /^\s*$/;
            val = val.replace(/[\ud800-\udbff][\udc00-\udfff]/gi,'',val);
            $('#searchInput').val(val);
            if (emptypreg.test(val)) {
                jQuery('.weui-search-con').addClass('hide');
                $('#fileList-search').html('');
            } else {
                jQuery('.weui-search-con').removeClass('hide');
            }
            jQuery('.weui-cell__bd').find('.weui-search-value').text(val);
            height();
        }

        //清空内容
        $(document).off('tap.canclesearch').on('tap.canclesearch', '#searchCancel', function () {
            $('#searchInput').val('');
            $('.weui-search-con').addClass('hide');
            $('#fileList-search').html('');
        })
        //搜索结果
        $(document).off('tap.getdata').on('tap.getdata', '.weui-search-con', function () {
            getSearchData();
        })

    })
    function getSearchData(){
        var keyword = $('#searchInput').val();
        if (!_filemanage.datajson.param) _filemanage.datajson.param = {k: Math.random()};
        _filemanage.datajson.param.keyword = keyword;
        _filemanage.datajson.param.fid = fid;
        _filemanage.datajson.param.cid = cid;
        _filemanage.datajson.param.collect = collect;
        _filemanage.datajson.param.page = '';
        _filemanage.getData();
        height();
        return false;
    }
    //获取id高度
    function height(){
        var h = $(document).outerHeight(true);
        var h1 = $('#searchBar').outerHeight(true);
        var h2 = $('.weui-search-con').outerHeight(true);
        if($('.weui-search-con').hasClass('hide')){
            $('.weui-cell-search-images').css('height',h-h1);
        }else{
            $('.weui-cell-search-images').css('height',h-h1-h2);
        }
        $('.weui-cells__margin_footer').css('margin-bottom',0);
    }

</script>
<!--{eval output();}-->
</html>

